package com.ruoyi.project.WebMoudle.shopCarouse.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.shopCarouse.mapper.ShopCarouselMapper;
import com.ruoyi.project.WebMoudle.shopCarouse.domain.ShopCarousel;
import com.ruoyi.project.WebMoudle.shopCarouse.service.IShopCarouselService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 店铺轮播Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-29
 */
@Service
public class ShopCarouselServiceImpl implements IShopCarouselService 
{
    @Autowired
    private ShopCarouselMapper shopCarouselMapper;

    /**
     * 查询店铺轮播
     * 
     * @param id 店铺轮播ID
     * @return 店铺轮播
     */
    @Override
    public ShopCarousel selectShopCarouselById(Long id)
    {
        return shopCarouselMapper.selectShopCarouselById(id);
    }

    /**
     * 查询店铺轮播列表
     * 
     * @param shopCarousel 店铺轮播
     * @return 店铺轮播
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<ShopCarousel> selectShopCarouselList(ShopCarousel shopCarousel)
    {
        return shopCarouselMapper.selectShopCarouselList(shopCarousel);
    }

    /**
     * 新增店铺轮播
     * 
     * @param shopCarousel 店铺轮播
     * @return 结果
     */
    @Override
    public int insertShopCarousel(ShopCarousel shopCarousel)
    {
        shopCarousel.setCreateTime(DateUtils.getNowDate());
        return shopCarouselMapper.insertShopCarousel(shopCarousel);
    }

    /**
     * 修改店铺轮播
     * 
     * @param shopCarousel 店铺轮播
     * @return 结果
     */
    @Override
    public int updateShopCarousel(ShopCarousel shopCarousel)
    {
        shopCarousel.setUpdateTime(DateUtils.getNowDate());
        return shopCarouselMapper.updateShopCarousel(shopCarousel);
    }

    /**
     * 删除店铺轮播对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteShopCarouselByIds(String ids)
    {
        return shopCarouselMapper.deleteShopCarouselByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除店铺轮播信息
     * 
     * @param id 店铺轮播ID
     * @return 结果
     */
    @Override
    public int deleteShopCarouselById(Long id)
    {
        return shopCarouselMapper.deleteShopCarouselById(id);
    }

    @Override
    public List<String> selectShopCarouselByShopId(Long shopId) {
        return shopCarouselMapper.selectShopCarouselByShopId(shopId);
    }
}
